import numpy as np
import pandas as pd

def load_tsp_data():
    data = pd.read_csv('./data/data.csv')
    # 追加 N+1 个节点
    # 作为 
    data_ext = data.copy()
    new_line = data_ext.iloc[0].copy()
    data_ext = data_ext._append(new_line)
    return data_ext

def get_adj_mat(data_df):
    n = len(data_df) # 
    data_df_mat = data_df[['X', 'Y']].values
    adj_mat = np.zeros((n, n))
    for i in range(n):
        for j in range(n):
            adj_mat[i, j] = (
                np.sqrt(
                    (
                        data_df_mat[i, 0] - data_df_mat[j, 0])**2 + (
                        data_df_mat[i, 1] - data_df_mat[j, 1])**2
                    ) # 两点间距离公式
                )
            
    for i in range(n):
        adj_mat[i, i] = 999
        
    return adj_mat
